// Created by Jisam on 2024/8/9 20:03.
// Purpose: Solve problem P2392, kkksc03's last-minute cramming before the exam
#include <bits/stdc++.h>

// Define various data types for convenience in pairs and vectors
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

// Define priority queues for processing integers in ascending and descending order
#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;

using namespace std;

// Function to solve the main problem
void solve() {
    // Initialize arrays for storing the number of items, heights, and dynamic programming results
    vector<int> a(5,0),h(21,0),dp(2501,0);
    // Read the number of items for each group
    for(int i = 1 ; i <= 4 ; i ++)
    {
        cin >> a[i];
    }
    // Initialize the total difference variable
    int t = 0;
    // Iterate through each group of items
    for(int i = 1; i <=4 ;i ++)
    {
        // Initialize the sum of heights for the current group
        int sum = 0;
        // Read the height of each item and calculate the total height
        for(int j = 1 ; j <= a[i]; j ++)
        {
            cin >> h[j];
            sum += h[j];
        }
        // Use dynamic programming to calculate the maximum similarity for the current group
        for(int j = 1 ; j <= a[i]; j ++)
        {
            for(int k = sum /2 ;k >= h[j] ; k --)
            {
                dp[k] = max(dp[k],dp[k - h[j]] + h[j]);
            }
        }
        // Update the total difference and reset the dynamic programming array for the next group
        t += sum - dp[sum / 2];
        for(int j=1;j<=sum/2;j++) dp[j]=0;
    }
    // Output the total difference
    cout<<t;
}

// Main function, entry point of the program
int main() {
    // Disable standard I/O synchronization for faster I/O
    ios::sync_with_stdio(false);
    // Disable cin's automatic binding to cout, further optimizing I/O
    cin.tie(nullptr);
    // Set the number of test cases to 1
    int T = 1;
    // Optionally read the number of test cases
//    cin >> T;
    // Iterate through each test case
    while (T--) solve();
    // Optionally output a newline for formatting
//    cout << "\n"[];
    return 0;
}
